package com.jf.yytgd.validation.constrain;

import com.jf.yytgd.validation.validator.TitleValidator;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * Created with IntelliJ IDEA
 * Description: 标题验证注解. 支持{String}数据类型. 验证标题是否超过限定字数(默认20字), null为非法
 * User:22954
 * Date:2025-01-22
 * Time:21:52
 */
@Documented
@Constraint(validatedBy = {TitleValidator.class})
@Target({METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE})
@Retention(RUNTIME)
public @interface Title {
    String message() default "{com.jf.yytgd.validation.constrain.Phone.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    int max() default 20;
}
